package org.fireflow2.designer.eclipse.properties.tab;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;

//import commonproperties.model.FileModel;

public class ParentPathPropertySection extends AbstractPropertySection {
//	private FileModel fileModel = null;

	private Text parentPath;

	@Override
	public void createControls(Composite parent,
			TabbedPropertySheetPage aTabbedPropertySheetPage) {
		super.createControls(parent, aTabbedPropertySheetPage);

		parent.setLayout(new GridLayout(1, false));
		parent.setLayoutData(new GridData(GridData.FILL_BOTH));

		Section section = getWidgetFactory().createSection(parent,
				Section.TITLE_BAR | Section.TWISTIE);
		section.setText("description");
		section.setLayout(new GridLayout(1, false));
		section.setLayoutData(new GridData(GridData.FILL_BOTH));

		Composite composite = getWidgetFactory().createComposite(section,
				SWT.NONE);
		composite.setLayout(new GridLayout(2, false));
		composite.setLayoutData(new GridData(GridData.FILL_BOTH));

		getWidgetFactory().createLabel(composite,"datafieldsWrapper Path: ");
		
		parentPath = getWidgetFactory().createText(composite, "",
				SWT.SINGLE | SWT.BORDER);
		parentPath.setText("");
		parentPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

		section.setClient(composite);
	}

	@Override
	public void refresh() {
		super.refresh();
//		parentPath.setText(fileModel.getFile().getParent());
	}

	@Override
	public void setInput(IWorkbenchPart part, ISelection selection) {
		super.setInput(part, selection);
		Object obj = ((IStructuredSelection) selection).getFirstElement();
//		if (obj instanceof FileModel) {
//			fileModel = (FileModel) obj;
//		}
	}


}
